package com.whmall.service.crm.runner;

import com.whmall.service.crm.module.companycertificatechemical.CompanyCertificateChemicalService;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

/**
 * 重新生成所有公司证照化合物审批Runner
 *
 * @author alex
 * @since 2020/12/19
 */
@Component
@ConditionalOnProperty(prefix = "runner", value = "rebuild-company-certificate-chemical-approve", havingValue = "true")
@RequiredArgsConstructor
public class RebuildCompanyCertificateChemicalApproveRunner implements CommandLineRunner {
    private final CompanyCertificateChemicalService companyCertificateChemicalService;


    @Override
    public void run(String... args) throws Exception {
        companyCertificateChemicalService.deleteAllApproveList();
        companyCertificateChemicalService.rebuildAllApproveFromAssociated();
    }
}
